#coding=utf-8
import os
import glob



#整合一个文件夹里的所有csv文件到一个文件里
def mergeCsvFile():
    wpath="D:/DigitalC_data/" #文件路径
    sname="./DigitalC_data/11_1_100.csv"

    with open(sname,'a+',encoding='utf-8') as wf:
        for input_file in glob.glob(os.path.join(wpath, '*.*')):
            with open(input_file,'r') as rf:
                alllines=rf.readlines()
                for line in alllines:
                    wf.write(line)
    print("done at",sname)

def csvToDArrary(csvpath):#csv文件转二维数组
	cdata = []
	with open(csvpath, 'r', encoding='gbk') as rfile:
		for line in csv.reader(rfile, delimiter=','):
			cdata.append(line)
	return cdata

#二维数组写入csv 不用pandas
def arrayToCsv(arr,spath):
    with open(spath,'w', newline='') as sf:
        filewriter = csv.writer(sf, delimiter=',')
        for line in arr:
            filewriter.writerow(line)


### 关于csv库
'''
csv读入的每一行是一个列表，里面元素类型为str
'''
